Skip to content

test: add proptest coverage for task-registry and reward-engine (#86) - #90

Open
Cmitchelle7 wants to merge 4 commits into
ecotask-network:mainfrom
Cmitchelle7:test/86-proptest-coverage
Open

test: add proptest coverage for task-registry and reward-engine (#86)#90
Cmitchelle7 wants to merge 4 commits into
ecotask-network:mainfrom
Cmitchelle7:test/86-proptest-coverage

Conversation

@Cmitchelle7

Copy link
Copy Markdown

Summary

eco-token had proptest coverage for mint/transfer/burn (#41); task-registry
and reward-engine had none. This adds property-based fuzz tests for both,
following eco-token's existing pattern (ProptestConfig::with_cases(20)).

task-registry (3 properties)

  • proptest_create_task_validation — create_task succeeds iff
    reward_amount > 0 && max_completions > 0 && expires_at > now, over
    randomized inputs including boundary/negative cases.
  • proptest_expiry_boundary — complete_task succeeds iff the probe
    timestamp is <= expires_at, exercising the strict-less expiry
    semantics right around the boundary.
  • proptest_completion_count_invariant — asserts completions <= max_completions holds after every call in a randomized sequence, and
    that status flips to Completed exactly when the cap is hit.

reward-engine (3 properties)

  • proptest_reward_range_enforced — approve_proof succeeds iff
    reward_amount is within the configured [min_reward, max_reward]
    and within the task's declared budget.
  • proptest_total_paid_accumulationtotal_paid() equals the running
    sum of approved rewards across a randomized sequence of approvals.
  • proptest_cooldown_boundary — a second approval for the same user
    succeeds iff elapsed ledgers since the last reward are >= cooldown,
    covering the saturating_sub boundary from both sides.

Other changes

  • Added proptest = "=1.6.0" to [dev-dependencies] in both
    task-registry/Cargo.toml and reward-engine/Cargo.toml (previously
    only eco-token had it).

Verification note

I was not able to run cargo test myself against a full Soroban
toolchain — I've cross-checked the function signatures, imports, and
types used here against the actual source (create_task,
complete_task, Ledger trait usage, etc.), but this hasn't been
compiled end-to-end. Flagging that explicitly so review/CI catches
anything I couldn't. Happy to fix quickly if CI turns up an issue.

Out of scope

  • Adding new notification types / production logic changes
  • Integration fuzz, mutation testing

Closes #86

@Cmitchelle7

Copy link
Copy Markdown
Author

CI hasn't run on this PR yet — it's sitting on "awaiting approval" for a first-time/external contributor. Could a maintainer approve the workflow run when you get a chance? This branch has been through a merge-conflict resolution since the original push (4 commits total now) so I'd like CI's confirmation it all still compiles cleanly before this sits idle any longer. @cybermax4200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No property-based fuzz tests for task-registry or reward-engine — only eco-token has proptest coverage

1 participant